import React, { useMemo } from 'react';
import { FuncTypes } from './interface';
import { Selector, EditStatus } from 'gantd';
import type { SelectProps } from 'antd/es/select';
import { keys } from 'lodash';

type FuncTypeProps = SelectProps;

const FuncType = (props: FuncTypeProps) => {
  const dataSource = useMemo(() => keys(FuncTypes).map((value) => ({ value, label: FuncTypes[value] })), []);
  return <Selector useStorage={false} edit={EditStatus.EDIT} dataSource={dataSource} {...props} />;
};

export default FuncType;

export { FuncTypes };
export { FuncTypeKeys } from './interface';
